package com.itany.nmms.service;

import com.itany.nmms.entity.Product;
import com.itany.nmms.exception.FileUploadErrorException;
import com.itany.nmms.exception.ProductExistException;
import com.itany.nmms.exception.RequestParameterErrorException;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/3/15 13:34
 * Version:1.0-SNAPSHOT
 */
public interface ProductService {

    /**
     * 添加商品
     * @param name
     * @param price
     * @param file
     * @param typeId
     * @throws RequestParameterErrorException
     * @throws ProductExistException
     * @throws FileUploadErrorException
     */
    public void addProduct(String name, String price, MultipartFile file, String typeId) throws RequestParameterErrorException, ProductExistException, FileUploadErrorException;

    /**
     * 查询所有商品
     * @return
     */
    public List<Product> findAll();

    /**
     * 修改设置默认值
     * @param id
     * @return
     */
    public Product findById(String id) throws RequestParameterErrorException;

    /**
     * 修改商品信息
     * @param id
     * @param name
     * @param price
     * @param file
     * @param typeId
     */
    public void modifyProduct(String id, String name, String price, MultipartFile file, String typeId) throws RequestParameterErrorException, ProductExistException, FileUploadErrorException;

    /**
     * 删除指定商品
     * @param id
     */
    public void removeProduct(String id) throws RequestParameterErrorException;
}
